home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 64 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.3 KB

  1. From: vandevod@cs.rpi.edu (David Vandevoorde)
  2. Message-ID: <xsobuo2pbbn.fsf@avs.cs.rpi.edu>
  3. X-Original-Date: 17 Jan 1996 19:59:24 -0500
  4. Path: in2.uu.net!bounce-back
  5. Date: 18 Jan 96 02:41:35 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: type_info
  9. Organization: RPI Computer Science
  10. References: <30FD350D.A71@xagony.ilo.dec.com>
  11. In-Reply-To: "B. Dalton"'s message of 17 Jan 1996 12:22:51 PST
  12. X-Newsreader: Gnus v5.1
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBFAgUBMP2za+EDnX0m9pzZAQF2+wF+Oddt6d4EVOMvxmrNcH7skgGyqGEJPdOR
  15.     A69nfwSmOFdU+pQqVr0PhFw13RIfoS9G
  16.     =YujM
  17.  
  18. >>>>> "BD" == "B Dalton" <bdalton@xagony.ilo.dec.com> writes:
  19. BD> class beatha{public:virtual ~beatha(){};}
  20. BD> class duine:public beatha{};
  21. BD> class gael: public duine {};
  22.  
  23. BD> beatha *pd=new gael;
  24. BD> if(typeid(pd)==typeid(duine)
  25. BD> {    cout<<"duine";
  26. BD> }
  27. BD> ...
  28. BD> does "duine" get printed here or not?
  29.  
  30. No, it doesn't since typeid(pd) = typeid(beatha*).
  31. You probably meant `if(typeid(*pd)==typeid(duine)) ...',
  32. but even then the answer is `no': typeid(*pd)==typeid(gael).
  33.  
  34.     Daveed
  35. ---
  36. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  37.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  38.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  39.